import { getLevelFirst, getLevelSecond, getLevelZero, getUserID } from '@/utils';

/** 合同汇总统计数据范围 */
const contractCountSwitch = (curRes: Record<string, any>) => {
  if (curRes?.['/contractReportController/all']) {
    return {
      // companyID: getLevelZero(),
      params: 'all',
    };
  } else if (curRes?.['/contractReportController/companyID']) {
    return {
      companyID: getLevelZero(),
      params: 'companyID',
    };
  } else if (curRes?.['/contractReportController/departmentID']) {
    return {
      departmentID: getLevelFirst(),
      params: 'departmentID',
    };
  }
  // if (curRes?.['/contractReportController/positionID']) {
  //   return {
  //     positionID: getLevelSecond(),
  //     params: 'positionID',
  //   };
  // } else
  else if (curRes?.['/contractReportController/userID']) {
    return {
      userID: getUserID(),
      params: 'userID',
    };
  } else {
    return {};
  }
};

/**
 * 供应商管理权限
 * @param curRes
 * @returns
 */
const getOppositeQueryInfo = (curRes: Record<string, any>) => {
  if (curRes?.['/supplierInfoController/createCompanyID']) {
    return {
      createCompanyID: getLevelZero(),
      params: 'createCompanyID',
    };
  } else if (curRes?.['/supplierInfoController/createDepartmentID']) {
    return {
      createDepartmentID: getLevelFirst(),
      params: 'createDepartmentID',
    };
  }
  return {};
};

export { contractCountSwitch, getOppositeQueryInfo };
